// @ts-ignore
const downloadBlob = ({ fileName, source }) => {
  const url = URL.createObjectURL(new Blob([source], { type: "application" }));
  const el = document.createElement("a");
  el.download = fileName;
  el.style.display = "none";
  el.href = url;
  document.body.appendChild(el);
  el.click();
  document.body.removeChild(el);
  URL.revokeObjectURL(url);
};

export const downloadLink = (link: string) => {
  const el = document.createElement("a");
  el.style.display = "none";
  el.href = link;
  el.download = 'true'
  document.body.appendChild(el);
  el.click();
  document.body.removeChild(el);
}

export default downloadBlob;
